package com.md.mapper;

import com.md.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface StudentMapper {
    @Select("select * from student")
    List<Student> selectAll();

    @Select("select * from student where studentId=#{studentId}")
    Student selectById(int id);

    @Delete("delete from student where studentId=#{studentId} ")
    int deleteById(int id);

    @Update("update student set studentName = #{studentName},classname=#{classname},classTeacher=#{classTeacher} where studentId=#{studenId}")
    int updateById(Student student);

    @Insert("insert into student (studentName, classname, classTeacher)values (#{studentName},#{classname},#{classTeacher})")
    List<Student> insertById(Student student);

    @Select("select * from student where student.studentName like '%${studentName}'")
    List<Student> selectByIds(String classname);

}